﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DemoConstructor.Demo3
{
    class Demo3
    {
        public static void RundDemo3()
        {        
            SecondClass theSecond = new SecondClass("","");
            Console.WriteLine(Environment.NewLine);
            ThirdClass theThird = new ThirdClass("", "");
        }
    }

    class FirstClass //: Object
    {
        /// <summary>
        /// Construstor
        /// </summary>
        public FirstClass()
        {
            Console.WriteLine("Constructor with no param of FirstClass was called.");
        }

        public FirstClass(string firstParam)
        {
            Console.WriteLine("Constructor with one param of FirstClass was called.");
        }

        public FirstClass(string firstParam, string secondParam)
        {
            Console.WriteLine("Constructor with two params of FirstClass was called.");
        }
    }

    class SecondClass : FirstClass
    {
        /// <summary>
        /// Construstor
        /// </summary>
        public SecondClass()
        {
            Console.WriteLine("Constructor with no param of SecondClass was called.");
        }

        public SecondClass(string firstParam)
        {
            Console.WriteLine("Constructor with one param of SecondClass was called.");
        }

        public SecondClass(string firstParam, string secondParam)
        {
            Console.WriteLine("Constructor with two params of SecondClass was called.");
        }
    }

    class ThirdClass : FirstClass
    {
        /// <summary>
        /// Construstor
        /// </summary>
        public ThirdClass()
        {
            Console.WriteLine("Constructor with no param of ThirdClass was called.");
        }

        public ThirdClass(string firstParam)
            :base(firstParam)
        {
            Console.WriteLine("Constructor with one param of ThirdClass was called.");
        }

        public ThirdClass(string firstParam, string secondParam)
            :base(firstParam, secondParam)
        {
            Console.WriteLine("Constructor with two params of ThirdClass was called.");
        }
    }
}
